from django.conf.urls import url
from rest_framework_jwt.views import obtain_jwt_token
from rest_framework.routers import DefaultRouter

from meiduo_admin.views import admin_user
from meiduo_admin.views import brands
from meiduo_admin.views import goods,options,channel
from meiduo_admin.views import groups
from meiduo_admin.views import images,skus
from meiduo_admin.views import orders
from meiduo_admin.views import permission
from meiduo_admin.views import specs
from .views import statistical,users
urlpatterns = [
    url(r'^authorizations/$', obtain_jwt_token),
    #--------数据统计------
    #用户总量统计
    url(r'^statistical/total_count/$', statistical.UserCountView.as_view()),
    # 当天用户注册总量统计
    url(r'^statistical/day_increment/$', statistical.UserDayCountView.as_view()),
    # 日活总量统计
    url(r'^statistical/day_active/$', statistical.UserActiveCountView.as_view()),
    #日下单用户总量统计
    url(r'^statistical/day_orders/$', statistical.UserOrderCountView.as_view()),
    #月曾用户总量统计
    url(r'^statistical/month_increment/$', statistical.UserMonthCountView.as_view()),
    # 日分类商品访问量统计
    url(r'^statistical/goods_day_views/$', statistical.GoodsCountView.as_view()),
    #------------用户管理--------------
    url(r'^users/$', users.UserView.as_view()),
    # ------------------商品规格表管理------------------
    url(r'^goods/simple/$', specs.SpecView.as_view({'get': 'simple'})),
    # ------------------商品图片表管理------------------
    url(r'^skus/simple/$', images.ImageView.as_view({'get': 'simple'})),
    # ------------------sku表管理------------------
    url(r'^goods/(?P<pk>\d+)/specs/$', skus.SKUView.as_view({'get': 'specs'})),
    # -----------------权限表管理------------------
    url(r'^permission/content_types/$', permission.PermissionView.as_view({'get': 'content_types'})),


    url(r'^permission/simple/$', groups.GroupView.as_view({'get': 'simple'})),
    url(r'^permission/groups/simple/$', admin_user.AdminUserView.as_view({'get': 'simple'})),    # -----------------权限表管理------------------
    url(r'^goods/brands/simple/$', goods.SPUView.as_view({'get': 'simple'})),
    url(r'^goods/channel/categories/$', goods.SPUView.as_view({'get': 'channel'})),
    url(r'^goods/channel/categories/(?P<pk>\d+)/$', goods.SPUView.as_view({'get': 'channels'})),
    url(r'^goods/specs/simple/$', options.OptionSimple.as_view()),
    url(r'^goods/channel_types/$', channel.ChannelView.as_view({'get': 'channel_types'})),
    url(r'^goods/categories/$', channel.ChannelView.as_view({'get': 'categories'})),

    # url(r'^goods/specs/simple/$', options.OptionsView.as_view({'get': 'simple'})),

    # url(r'^goods/specs/simple/$', options.OptionsView.as_view({'get': 'simple'})),
]
# ------------商品管理--------------
router=DefaultRouter()
router.register('goods/specs',specs.SpecView,base_name='spec')
urlpatterns+=router.urls

# ------------------品牌表管理------------------
router = DefaultRouter()
router.register('goods/brands', brands.BrandView, base_name='brands')
urlpatterns += router.urls
# ------------------商品图片表管理------------------

router = DefaultRouter()
router.register('skus/images', images.ImageView, base_name='image')
urlpatterns += router.urls

# ------------------频道表管理------------------
router = DefaultRouter()
router.register('goods/channels', channel.ChannelView, base_name='channel')
urlpatterns += router.urls
# ------------------sku表管理------------------

router = DefaultRouter()
router.register('skus', skus.SKUView, base_name='skus')
urlpatterns += router.urls

# ------------------订单表管理------------------

router = DefaultRouter()
router.register('orders', orders.OrderView, base_name='orders')
urlpatterns += router.urls


# -----------------权限表管理------------------

router = DefaultRouter()
router.register('permission/perms', permission.PermissionView, base_name='perms')
urlpatterns += router.urls


# -----------------分组表管理------------------

router = DefaultRouter()
router.register('permission/groups', groups.GroupView, base_name='perms')
urlpatterns += router.urls
# -----------------管理员管理------------------

router = DefaultRouter()
router.register('permission/admins', admin_user.AdminUserView, base_name='admin')
urlpatterns += router.urls

# ------------------spu表管理------------------

router = DefaultRouter()
router.register('goods', goods.SPUView, base_name='goods')
urlpatterns += router.urls
# ------------------规格选项表管理------------------
router = DefaultRouter()
router.register('specs/options', options.OptionsView, base_name='options')
urlpatterns += router.urls